package cn.mdx.controller;

import cn.mdx.adminservice.AdminService;
import cn.mdx.common.beans.ResultBean;
import cn.mdx.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.PrintWriter;

@RestController
@Controller
@CrossOrigin
public class AdminLoginController {

    @Autowired
    private AdminService adminService;

    @PostMapping("/ladminlogin")
    public ResultBean adminlogin(HttpSession session, String username, String password){
        Admin admin=adminService.login(username,password,session);
        return new ResultBean(admin);
    }

}
